import instance from '../util/api'

//获取分享时间
export const getValidDate = () => {
  return instance.post('/share/getValidDaysbyValidIds')
}
export const getAllValidInfo = () => {
  return instance.get('/share/getAllValidInfo')
}
//分享文件
export const singleShareService = (fileId, validId, userId, code) => {
  return instance.post('/share/ShareFile', {
    fileId,
    validId,
    userId,
    code
  })
}

//校验分享码
export const checkShareCode = (shareId, code) => {
  return instance.get('/share/checkShareCode', {
    params: {
      shareId,
      code
    }
  })
}

//获取用户所有分享
export const getUserShares = (userId) => {
  return instance.get('/share/getusershares', {
    params: {
      userId
    }
  })
}

//取消分享
export const cancelShare = (shareId) => {
  return instance.get('/share/cancelShare', {
    params: {
      shareId
    }
  })
}
